﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using VFDDriver.Properties;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Text;
using VFDDriver.VFD;

namespace VFDDriver
{
    class Program
    {

        public static IDriver Driver;
        enum Alignment
        {
            Left,
            Right,
            Center
        }
        static bool _run = true;
        static void Main(string[] args)
        {
            Driver = DisplayDriver.Instance;

            //Data.Instance.SetData(1, "TestTestTestTestTestTest", VFDDriver.Alignment.Left);
            //Data.Instance.SetData(2, "${date} ${time}", VFDDriver.Alignment.Center);

            

            Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);

            Driver.Initialize();
            XBMC.XBMCData.Instance.Start();
            while (_run)
            {
                Driver.WriteLine(1, Data.Instance.GetData(1));
                Driver.WriteLine(2, Data.Instance.GetData(2));
                Thread.Sleep(Settings.Default.VFD_RefreshRate);
            }

            XBMC.XBMCData.Instance.Stop();
            Driver.Terminate();

        }

        
        static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
        {
            _run = false;
        }
    }
}
